from django.db import models

from apps.prescription.models import Prescription
from apps.staruser.models import StarUser
from apps.website.models import Rad
from op_drf.base import BaseModel

# Create your models here.

class Order(BaseModel):
<<<<<<< HEAD
    ordernum = models.CharField(max_length=20,verbose_name="订单编号",help_text="订单编号",null=True)
    order_date = models.DateTimeField(verbose_name="订单日期",help_text="订单日期",null=True)
    prescription = models.ForeignKey(Prescription,on_delete=models.CASCADE,verbose_name="处方",help_text="处方")
    rad = models.ForeignKey(Rad,on_delete=models.CASCADE,verbose_name="摆药机",help_text="摆药机")
    staruser = models.ForeignKey(StarUser,null=True,on_delete=models.SET_NULL,verbose_name="顾客",help_text="顾客")
=======
    ordernum = models.CharField(max_length=20,verbose_name="订单编号",help_text="订单编号",null=False,blank=True,default="")
    order_date = models.DateTimeField(verbose_name="订单日期",help_text="订单日期",null=True)
    prescription = models.ForeignKey(Prescription,on_delete=models.CASCADE,verbose_name="处方",help_text="处方")
    rad = models.ForeignKey(Rad,on_delete=models.CASCADE,verbose_name="摆药机",help_text="摆药机")
    staruser = models.ForeignKey(StarUser,on_delete=models.CASCADE,verbose_name="顾客",help_text="顾客",null=True)
>>>>>>> dev
    pick_type = models.CharField(max_length=20,verbose_name="提取方式",help_text="提取方式",null=False,default="自提")
    ORDER_STATUS = (("0", "初始化"), ("1", "已摆药"))
    OrderStatus = models.CharField(max_length=20, null=False, default="0", choices=ORDER_STATUS, verbose_name="状态",
                                   help_text="状态")

    class Meta:
        db_table = "xyx_Order"
        verbose_name = "药品订单"
        verbose_name_plural = verbose_name